import { Col, Input, Row } from 'antd';
import React from 'react';
import styles from '../styles.less';

function Enums({ value, onChange }) {
  const { enums = [] } = value;

  return (
    <Row style={{ width: '100%' }}>
      <Col style={{ display: 'flex', alignItems: 'center' }}>
        <div className={styles.label}>枚举值</div>
        <div className={styles.item} style={{ flexGrow: 1 }}>
          <Input.TextArea
            style={{ width: 300 }}
            value={enums.join('\n')}
            onChange={e => {
              const { value } = e.target;
              onChange({ enums: value.split('\n') });
            }}
            placeholder="每行只能写一个值"
            autoSize={{ minRows: 2, maxRows: 6 }}
          />
        </div>
      </Col>
    </Row>
  );
}

export default Enums;
